package com.lmx.repoDomain.tmodel;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToMany;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 外伤史
 * @author han
 *
 */
@JsonApiResource(type = "injuryhistory")
@Table(name = "tnb_injury_history")
@Entity
public class InjuryHistory extends BaseEntity {
	
	private HealthRecord healthrecord; //对应的健康档案表
	
	private String injuryName; //外伤名称	
	
	private Integer injuryTime; //外伤的时间
	
	private Dicttype operatInjuryType; //手术史名称类型
	
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "health_record_id", nullable = true, foreignKey = @ForeignKey(name = "null"))
	public HealthRecord getHealthrecord() {
		return healthrecord;
	}   

	public void setHealthrecord(HealthRecord healthrecord) {
		this.healthrecord = healthrecord;
	} 
	
	@Column(name="injury_name")
	public String getInjuryName() {
		return injuryName;
	}

	public void setInjuryName(String injuryName) {
		this.injuryName = injuryName;
	}

	@Column(name="injury_time")
	public Integer getInjuryTime() {
		return injuryTime;
	}

	public void setInjuryTime(Integer injuryTime) {
		this.injuryTime = injuryTime;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "operatinjurytype_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getOperatInjuryType() {
		return operatInjuryType;
	}

	public void setOperatInjuryType(Dicttype operatInjuryType) {
		this.operatInjuryType = operatInjuryType;
	}


}       